<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>WEAVER行政执法信息系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="x-ua-compatible" content="ie=8">
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<link rel="shortcut icon" href="images/icon/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="css/simple-line-icons/css/simple-line-icons.css"/>
<link rel="stylesheet" href="css/mdi/css/materialdesignicons.css"/>
<script src="jquery/jquery.min.js"></script>
<script src="bootstrap/bootstrap.min.js"></script>
<link rel="stylesheet" href="css/style.css"/>
<link rel="stylesheet" href="layui/layui/css/layui.css" media="all">
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" />
<!-- 皮肤 -->
<link rel="stylesheet" href="layui/layui/css/modules/skin.css" media="all">
<script src="layui/layui/layui.js" charset="utf-8"></script>
<!-- ExtJs-->
<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="extjs/ext-all.js"></script>
<style type="text/css">
 html,body{
  background:url("images/lgeisLogin.jpg") no-repeat;
  background-size: 100%;
}
</style>
</head>
<body style="overflow: hidden;">
<input type="hidden" id="contextPath" name="contextPath" th:value="${#request.getContextPath()}">
<div class="container-scroller">
  <div class="container-fluid page-body-wapper">
    <div class="row">
      <div class="login-wrapper full-page-wrapper d-flex align-items-center text-center error-page">
        <div class="card col-lg-5 ml-auto mr-auto">
          <div class="card-body">
            <h2 class="card-title text-center"><span style="font-size: 30px;font-weight: bolder;">WEAVER行政执法信息系统</span></h2>
            <form class="form-signin">
              <div class="form-group">
                <div class="input-group">
                  <span class="input-group-addon"><i class="icon-user"></i></span>
                  <input type="text" id="username" name="username" class="form-control" lay-verify="required" placeholder="请输入用户名" >
                </div>
              </div>
              <div class="form-group">
                <div class="input-group">
                  <span class="input-group-addon"><i class="icon-lock"></i></span>
                  <input type="password" id="password" name="password" class="form-control" lay-verify="required" placeholder="请输入密码" >
                </div>
              </div>
              <div class="text-center">
                <button type="submit" lay-filter="login" lay-submit="" class="btn btn-primary">登录</button>
                <button type="reset" class="btn btn-primary">重置</button>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript" th:inline="javascript">
	$(function() {
		var message= [[${jsonData}]];
		layui.use('form', function() {
			var form = layui.form;
			form.on('submit(login)', function(data) {
				var username = document.getElementById("username").value;
				var password = document.getElementById("password").value;
				if (username == '') {
					layer.msg('用户名不能为空', {
						icon : 5,
						anim : 6,
						offset : [ '480px', '1250px' ]
					});
					return false;
				}
				if (password == '') {
					layer.msg('密码不能为空', {
						icon : 5,
						anim : 6,
						offset : [ '480px', '1250px' ]
					});
					return false;
				}
				requestData={"username" : username,"password" : password,"rememberMe":false}
				var index = layer.load(3);
				var contextPath = document.getElementById("contextPath").value;
				var url = contextPath+"/ajaxLogin";
				Ext.Ajax.request({
					  url : url,
					  params : requestData,
					  success : function(request) {
						  var data = jQuery.parseJSON(request.responseText);
						  var icon ="";
						  if(data.code=='0'){
							  icon=1
						  }else{
							  icon=2 
						  }
						  layer.close(index);
						  layer.alert(data.message, {icon: icon,skin:'layer-myskin',zIndex: layer.zIndex},function(index,layero) {
							  layer.setTop(layero);
							  layer.close(index);
							  location.href = contextPath+"/index";
				           });
					  	},
					  failure : function(response) {
						  layer.alert('系统异常', {icon: 2,skin:'layer-myskin',zIndex: layer.zIndex},function (index,layero) {
							  layer.setTop(layero);
							  layer.close(index);
				              window.parent.location.reload();
				            });
					  	}
				});
				return false;
			});
		});
	})
</script>
</body>
</html>